Skip to content

removed CppCheck dependency from CppCheckExecutor::parseFromArgs()#4967

Merged
firewave merged 2 commits intocppcheck-opensource:mainfrom
firewave:cmd-cppcheck
Apr 16, 2023
Merged

removed CppCheck dependency from CppCheckExecutor::parseFromArgs()#4967
firewave merged 2 commits intocppcheck-opensource:mainfrom
firewave:cmd-cppcheck

Conversation

@firewave
Copy link
Copy Markdown
Collaborator

@firewave firewave commented Apr 14, 2023

That function is basically just parsing the command-line options into the settings so no need for a CppCheck object yet. Also moved the object down to the actual usage.

Preparation for moving the Settings ownership out of CppCheck in #4964.

@firewave firewave marked this pull request as draft April 14, 2023 10:49
@firewave firewave changed the title removed CppCheck dependency from CppCheckExecutor::parseFromArgs() relaxed CppCheck dependencies in CppCheckExecutor Apr 14, 2023
@firewave firewave marked this pull request as ready for review April 14, 2023 10:59
Comment thread cli/cppcheckexecutor.cpp Outdated
}

CppCheck cppcheck(*this, true, executeCommand);
cppcheck.settings() = settings; // this is a copy
Copy link
Copy Markdown
Collaborator Author

@firewave firewave Apr 14, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This highlights the issue I want to resolve by moving the ownership out of CppCheck. We need to propagate back all the changes from the settings attached to CppCheck. In some cases we are not doing this correctly. This is why the settings should be immutable during the analysis so we don't have to do that.

Also we do that copy for each file with the multi-threaded implementation which is a hot spot if there are many libraries loaded.

@firewave firewave changed the title relaxed CppCheck dependencies in CppCheckExecutor removed CppCheck dependency from CppCheckExecutor::parseFromArgs() Apr 14, 2023
@firewave
Copy link
Copy Markdown
Collaborator Author

I backed out the further refactoring as it doesn't work until the ownership has been changed.

Comment thread cli/cppcheckexecutor.cpp
@firewave firewave merged commit 9ad26f5 into cppcheck-opensource:main Apr 16, 2023
@firewave firewave deleted the cmd-cppcheck branch April 16, 2023 11:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants